package com.kindness.frate.activity;

import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.kindness.frate.R;
import com.kindness.frate.utils.UIHelper;
import com.kindnesslibrary.adapter.CommonAdapter;
import com.kindnesslibrary.adapter.ViewHolder;
import com.kindnesslibrary.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

public class AllExampleActivity extends BaseActivity {

    RecyclerView rv_example;
    List<String> datas = new ArrayList<>();

    @Override
    protected void handlerMessage(Message msg) {

    }

    @Override
    protected int getLayout() {
        return R.layout.activity_all_example_layout;
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        rv_example = getView(R.id.rv_example);
        rv_example.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        datas.add("仿支付宝效果");
        datas.add("头像选择，支持6.0，7.0版本");
        datas.add("下拉放大图片");
        datas.add("左滑删除");
        datas.add("右划仿QQ效果");
        datas.add("RecyclerView下拉回弹效果");
        datas.add("ScrollView下拉回弹");
        datas.add("下拉刷新仿美团效果");
        datas.add("ScrollView+ViewPager效果");
        rv_example.setAdapter(new CommonAdapter<String>(this, R.layout.item_all_example_layout, datas){

            @Override
            public void convert(ViewHolder holder, String s) {
                View item_example_parent = holder.getView(R.id.item_example_parent);
                TextView item_tv_example = holder.getView(R.id.item_tv_example);
                item_tv_example.setText(s);
                item_example_parent.setOnClickListener(v -> {
                    switch (holder.getIndex()){
                        case 0:{
                            UIHelper.startActivity(AllExampleActivity.this, AliPayBehaviorActivity.class);
                        }
                        break;
                        case 1:{
                            UIHelper.startActivity(AllExampleActivity.this, AvatarChooseActivity.class);
                        }
                        break;
                        case 2:{
                            UIHelper.startActivity(AllExampleActivity.this, ChangeBackActivity.class);
                        }
                        break;
                        case 3:{
                            UIHelper.startActivity(AllExampleActivity.this, LeftDeleteActivity.class);
                        }
                        break;
                        case 4:{
                            UIHelper.startActivity(AllExampleActivity.this, MainActivity.class);
                        }
                        break;
                        case 5:{
                            UIHelper.startActivity(AllExampleActivity.this, PtrRecyclerViewActivity.class);
                        }
                        break;
                        case 6:{
                            UIHelper.startActivity(AllExampleActivity.this, PtrScrollViewActivity.class);
                        }
                        break;
                        case 7:{
                            UIHelper.startActivity(AllExampleActivity.this, PullRefreshActivity.class);
                        }
                        break;
                        case 8:{
                            UIHelper.startActivity(AllExampleActivity.this, PullZoomViewPagerActivity.class);
                        }
                        break;
                        case 9:{
                            UIHelper.startActivity(AllExampleActivity.this, SnapActivity.class);
                        }
                        break;
                    }
                });
            }
        });
    }

    @Override
    protected void initEvent() {

    }
}
